import { Component } from '@angular/core';
import { Platform } from "@ionic/angular";
import { StatusBar } from "@capacitor/status-bar";

@Component({
	selector: 'app-root',
	templateUrl: './app.component.html',
	styleUrls: ['./app.component.scss']
})
export class AppComponent {

	constructor(
		private platform: Platform,
	) {
		this.initializeApp();
	}

	initializeApp(): void {
		this.platform.ready().then(() => {
			this.setScreenOrientation();
			this.setStatusBar();
		});
	}

	private setScreenOrientation(): void {
		screen?.orientation?.lock('landscape-primary').then((res) => {
			console.log(res);
		}).catch((err) => {
			console.warn(err);
		});
	}

	private setStatusBar(): void {
		StatusBar.hide().then((res) => {
		}).catch((e) => {
		});
		StatusBar.setOverlaysWebView({ overlay: true }).then((res) => {
		}).catch((e) => {
		});
	}

}
